package test01;

import java.util.Scanner;

public class Test_比较简单的题 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] ints = new int[n * 2];
        for (int i = 0; i < n * 2; i++) {
            ints[i] = scanner.nextInt();
        }
        int[][] dp = new int[2][n * 2];
        dp[0][0] = ints[0];
        dp[1][0] = ints[0];
        dp[0][1] = Math.max(ints[0], ints[1]);
        dp[1][1] = Math.min(ints[0], ints[1]);
        int sum=ints[0]+ints[1];
        for (int i = 2; i < dp[0].length; i++) {
            dp[0][i]=Math.max(dp[0][i-1],dp[1][i-1]+ints[i]);
            sum+=ints[i];
            dp[1][i]=sum-dp[0][i];
        }
        for (int[] d : dp) {
            for (int p : d) {
                System.out.print(p+" ");
            }
            System.out.println();
        }
    }
}
